<%-- 
    Document   : index
    Created on : 14-dic-2011, 20:37:57
    Author     : Administrador
--%>

<%@page import="javax.sql.DataSource"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
        <%= new java.util.Date()%>

        <%
            try {
                DataSource ds = (DataSource) application.getAttribute("datasource"); 
                Connection con = ds.getConnection();
                ResultSet rs = con.createStatement().executeQuery("select * from Persona");
                while (rs.next()) {
                    out.print(rs.getString("nombre") + "<br/>");
                }
                con.close();
            } catch (SQLException sQLException) {
                application.log("Error acceso datos: ", sQLException);
            }
        %>

    </body>
</html>
